//
//  nlogonia.c
//  complexidade
//  https://br.spoj.pl/problems/NLOGONIA/
//  Created by Bruno Dias on 31/05/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.

#include <stdio.h>

int main()
{
        int i, n, m, x, y, k;
        for (scanf("%d", &k); k != 0; scanf("%d", &k))
        {
                scanf("%d %d", &n, &m);
                for (i = 0; i < k; ++i)
                {
                        scanf("%d %d", &x, &y);

                        if (x == n|| y == m)
                                printf("divisa\n");
                        if (x > n && y > m)
                                printf("NE\n");
                        if (x < n && y > m)
                                printf("NO\n");
                        if (x > n && y < m)
                                printf("SE\n");
                        if (x < n && y < m)
                                printf("SO\n");                      
                }
        }

        return 0;
}